package com.semidata.rtd.core.job;

public abstract class AbstractJob<C extends JobContext> implements Job<C> {

    private JobTimeoutService jobTimeoutService;

    public AbstractJob(JobTimeoutService jobTimeoutService) {
        this.jobTimeoutService = jobTimeoutService;
    }
    
    @Override
    public void run() {
        if (jobTimeoutService != null)
            jobTimeoutService.send(this);
        this.getTaskScheduler().schedule();
    }

    @Override
    public void cancel() {
        this.getTaskScheduler().cancel();
        
    }
}
